package com.studychen.appfxcp.commom.view;

import com.studychen.appfxcp.commom.vo.BookkeepingItem;
import javafx.scene.control.Button;
import javafx.scene.control.TableCell;
import javafx.scene.control.TableRow;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class OptionTableListCell extends TableCell<BookkeepingItem, String> {

    public void updateItem(String item, boolean empty){
        super.updateItem(item, empty);
        if (empty){
            return;
        }

        TableRow row = getTableRow();
        BookkeepingItem item1 = (BookkeepingItem) row.getItem();
        String id = item1.getId();
        String name = item1.getName();
        log.info("id:\t{}, name:{}", id, name);
        Button button = new Button("产看");
        button.setOnAction(e -> {
            log.info(item1.toString());
        });
        this.setGraphic(button);

    }

}
